package com.gress.shop.controller.websoket;


import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import java.util.concurrent.CopyOnWriteArraySet;

/**
 * Created xiongwen with 2018/1/25 17:35
 * Description:
 */
@ServerEndpoint("/web_socket")
public class WebSocketController {

    private static int onlineCount = 0;

    //concurrent包的线程安全Set，用来存放每个客户端对应的MyWebSocket对象。若要实现服务端与单一客户端通信的话，可以使用Map来存放，其中Key可以为用户标识
    private static CopyOnWriteArraySet<WebSocketController> webSocketSet = new CopyOnWriteArraySet<WebSocketController>();

    //与某个客户端的连接会话，需要通过它来给客户端发送数据
    private Session session;


}
